<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改物品管理')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-goods-edit" th:object="${goods}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">名称：</label>
                <div class="col-sm-8">
                    <input name="name" th:field="*{name}" class="form-control" type="text">
                </div>
            </div>
            <!-- <div class="form-group">    
                <label class="col-sm-3 control-label">用途：</label>
                <div class="col-sm-8">
                    <input name="use" th:field="*{use}" class="form-control" type="text">
                </div>
            </div>
             -->
            <h4 class="form-header h4">用途</h4>

            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-xs-2 control-label">正文:</label>
                        <div class="col-xs-10">
                            <script id="editor" name="use" type="text/plain" ></script>
                        </div>
                    </div>
                </div>
            </div>
            <textarea hidden="text" id="divdata">[[*{use}]]</textarea>            
            
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="memo" class="form-control">[[*{memo}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />    
    <th:block th:include="include :: ueditor" />
    <script type="text/javascript">
        var prefix = ctx + "cms/goods";
        $("#form-goods-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-goods-edit').serialize());
            }
        }
        var ue = UE.getEditor('editor');        
        $("#editor").css("height","380px");
      	//给UEeditor赋值
        var data=$("#divdata").text();
        var ue = UE.getEditor('editor');
        ue.ready(function() {//编辑器初始化完成再赋值
            ue.setContent(data);  //赋值给UEditor
        });

    </script>
</body>
</html>